package day01;

/**
 * @author feng
 * @Date 2021/10/14 11:39
 *  枚举方式实现单例
 */
public class Enum08 {
    public static void main(String[] args) {
        Singleton05 singleton = Singleton05.instance;
        Singleton05 singleton02 = Singleton05.instance;
        System.out.println(singleton==singleton02);
    }
}


enum Singleton05{
   instance;

   public void sayHello(){
       System.out.println("ok");
   }

}